"""
@File    : HW_object_oriented_programming_BankAccount.py
@Author  : WorldWind(1772830365@qq.com)
@Time    : 2025/7/11
"""

# 银行的这个方法回家重新写一下,要求有三元运算符,无bug
class BankAccount:
    balance = 0

    def __init__(self):
        print('This is __init__ method. Bank begin')

    # 存钱
    def credit(self, amount):
        self.balance = self.balance + amount

    # 取钱
    def withdraw(self, about):
        self.balance = self.balance - about

    # 打印余额
    def show(self):
        print(f'Your bank deposit is {self.balance} dollar')

    def __del__(self):
        print('This is __del__ method. The Bank class has been recycled')


bank = BankAccount()
amount = float(input("Please enter the amount you have deposited:"))
bank.credit(amount)
about = float(input("Please enter the amount you have withdrawn:"))
bank.withdraw(about)
bank.show()